/* Android-Michi is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * Android-Michi is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Android-Michi; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */
package controller;

import model.HumanTicTacToe;
import view.DisplayManager;
import view.TouchManager;
import android.app.Activity;
import android.widget.LinearLayout;

public class Controller implements ButtonInterface {
	Activity activity;
	DisplayManager displayManager;
	TouchManager touchManager;
	HumanTicTacToe model;
	LinearLayout layout;
	ButtonInterface bi;


	public Controller(Activity _activity)  {
		activity = _activity;
		displayManager = new DisplayManager(activity);
		touchManager = new TouchManager(activity, this);
		model = new HumanTicTacToe();
	}

	public void start() {
		displayManager.displayBlankGrid();
		touchManager.gridDisplayed();
		bi = new TwoPlayerMichi(displayManager);
	}


	public void restart() {
		displayManager.displayBlankGrid();
		touchManager.gridDisplayed();
		bi = new TwoPlayerMichi(displayManager);
	}

	public void restart1player() {
		displayManager.displayBlankGrid();
		touchManager.gridDisplayed();
		bi = new OnePlayerMichi(displayManager);
	}


	@Override
	public void btn00Event() {
		bi.btn00Event();
	}

	@Override
	public void btn01Event() {
		bi.btn01Event();
	}

	@Override
	public void btn02Event() {
		bi.btn02Event();
	}

	@Override
	public void btn10Event() {
		bi.btn10Event();	
	}

	@Override
	public void btn11Event() {
		bi.btn11Event();	
	}

	@Override
	public void btn12Event() {
		bi.btn12Event();
	}

	@Override
	public void btn20Event() {
		bi.btn20Event();
	}

	@Override
	public void btn21Event() {
		bi.btn21Event();
	}

	@Override
	public void btn22Event() {
		bi.btn22Event();
	}
}
